module Main (main) where

import XI.Directory.Parser
import XI.Directory.Todo
import XI.Directory.Types
import Text.ParserCombinators.Parsec.Prim

main = do 
	s<-parseFromFile parseDir "test.dir"
	case s of
		Left err -> do {putStr "parse error at "; print err}
		Right x  -> do 
			writeFile "test.res" $ unlines $ 
				["-- Parse and script. Should be like source script without comments", ""] ++ (scriptDir x)
			case todo x of
				Left err -> putStr err >> putStr "Error with todo!"
				Right x -> do
					-- putStr $ show x
					-- putStr $ "\n" ++ (show $ length x)
					case scenarios x of
						Left err -> putStr err >> putStr "Error with scenarios!"
						Right x -> do 
							-- putStr $ "\n" ++ (show x)
							writeFile "test2.res" $ unlines $ 
								["-- Make an Directory objects then gather all chains and script it.", ""] ++ (scriptDir x)

